# -*- coding: utf-8 -*-
"""
Created on Tue Jun 24 14:46:46 2025

@author: ZRK
"""
import numpy as np

# 创建示例数组
original = np.arange(12)
print("原始数组:", original)

# 重塑形状
reshaped = original.reshape(3, 4)
print("重塑为3x4:")
print(reshaped)

# 展平数组
flattened = reshaped.flatten()
print("展平数组:", flattened)


# 转置
transposed = reshaped.T
print("转置:")
print(transposed)

# 改变维度,将一维数组拓展为二维矩阵
expanded = np.expand_dims(original, axis=0)
print("扩展维度:", expanded.shape)